package stv5.abstracted;

import java.util.HashMap;

public abstract class AbstractManager implements EpisodeManager {

	/**
	 * In case we don't have any special settings, you can
	 * 	use this default implementation
	 */
	@Override
	public void appendSettingsList(HashMap<String, String> list) {		
	}
	
	public static String capitalizeWords(String str) {
		String[] words = str.split("\\s");
		String firstLetter;
		StringBuffer newname = new StringBuffer();
		for (int i=0; i<words.length; i++) {
			firstLetter = words[i].substring(0, 1);		
			try {				
				newname.append( words[i].replaceFirst(firstLetter, firstLetter.toUpperCase()) );
			} catch (Exception e) {}
			// just ignore the exception; it means the first character
			//  was not a letter
			if (i < words.length-1) newname.append(' ');				
		}	
		
		return newname.toString();
	}

	public static boolean isVideoFile(String filename) {
		return filename.endsWith(".avi")
				|| filename.endsWith(".ogm")
				|| filename.endsWith(".mkv")
				|| filename.endsWith(".mpg")
				|| filename.endsWith(".mpeg")
				|| filename.endsWith(".mp4");
	}

	public static boolean isSubtitleFile(String filename) {
		return filename.endsWith(".srt")
				|| filename.endsWith(".ass")
				|| filename.endsWith(".sub")
				|| filename.endsWith(".txt");
	}


}
